package ${package_service_impl};

import ${package_pojo}.${pojoName};
import java.util.List;
import java.util.Map;
import com.murp.university.util.PageUtil;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import ${package_dao}.I${pojoName}Dao;
import ${package_service}.I${pojoName}Service;

@Service
public class ${pojoName}ServiceImpl implements I${pojoName}Service {

	@Autowired
	private I${pojoName}Dao ${pojoNameLowser}Dao;
	
	@Override
    public PageUtil<${pojoName}> query${pojoName}PageList(Map<String, Object> params) {
    	PageUtil<${pojoName}> page = new PageUtil<${pojoName}>(params);
		page.setRows(${pojoNameLowser}.findBy(params));
		page.setTotal(${pojoNameLowser}.getCount(params));
        return page;
    }

    @Override
    public ${pojoName} query${pojoName}(Map<String, Object> params) {
        ${pojoName} result = null;
        List<${pojoName}> list = ${pojoNameLowser}Dao.query${pojoName}List(params);
        if(list != null && list.size() > 0) {
            result = list.get(0);
        }
        return result;
    }

    @Override
    public List<${pojoName}> query${pojoName}List(Map<String, Object> params) {
        return ${pojoNameLowser}Dao.query${pojoName}List(params);
    }

	@Transactional(rollbackFor = {Exception.class})
    @Override
    public void insert${pojoName}(${pojoName} param) {
        ${pojoNameLowser}Dao.insert${pojoName}(param);
    }

	@Transactional(rollbackFor = {Exception.class})
    @Override
    public void update${pojoName}(${pojoName} param) {
        ${pojoNameLowser}Dao.update${pojoName}(param);
    }

	@Transactional(rollbackFor = {Exception.class})
    @Override
    public void delete${pojoName}(${pojoName} param) {
        ${pojoNameLowser}Dao.delete${pojoName}(param);
    }
	
}